package com.jar.exercise.集合和数据结构.HashMap计算hash取余数;

import java.util.Objects;

/**
 * @author ZhangShengHao
 * @className Demo1
 * @description TODO
 * @date 2020/3/17 23:06
 */
public class Demo1 {
	public static void main(String[] args) {
        /*Stduent student = new Stduent("张珊", 12);
        Stduent student1 = new Stduent("张珊", 12);
        System.out.println(student.hashCode());
        System.out.println(student1.hashCode());
        boolean equals = student.equals(student1);
        System.out.println(equals);*/

	}
}

class Stduent {
	private String name;
	private Integer age;

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		Stduent stduent = (Stduent) o;
		return Objects.equals(name, stduent.name) &&
			Objects.equals(age, stduent.age);
	}

	@Override
	public int hashCode() {
		return Objects.hash(name, age);
	}

	public Stduent(String name, Integer age) {
		this.name = name;
		this.age = age;
	}


}
